﻿using static System.Console;

namespace Chapter04.DesignMode3 {
    public class CheesePizza(IPizzaIngredientFactory ingredientFactory) : Pizza {
        public IPizzaIngredientFactory IngredientFactory { get; init; } = ingredientFactory;

        /// <summary>
        /// 筹备
        /// </summary>
        public override void Prepare() {
            WriteLine($"Preparing {Name}");
            Dough = IngredientFactory.CreateDough();
            Sauce = IngredientFactory.CreateSauce();
            Cheese = IngredientFactory.CreateCheese();
        }
    }
}
